package com.haoan.index.common.enums;

import lombok.Getter;

/**
 * @Auther: Kai
 * @Date: 2024/8/1
 * @Description: 枚举demo
 */
/*
  SELECT concat( upper( a.dict_type),'_',a.dict_label,'("',a.dict_value,'","',a.dict_label,'","' ,concat(b.dict_name ,'-',a.dict_label),'"),')
  FROM sys_dict_data a
  LEFT JOIN sys_dict_type b ON a.dict_type = b.dict_type
  WHERE a.dict_type = 'XXX'
  ORDER BY a.dict_type ,a.dict_value
 */
@Getter
public enum _EnumDemo {
    NOT_FOUND("", "NULL", "NULL");

    private final String code;
    private final String name;
    private final String remark;

    _EnumDemo(String code, String name, String remark) {
        this.code = code;
        this.name = name;
        this.remark = remark;
    }

    public static _EnumDemo getByCode(String code) {
        for (_EnumDemo demoEnum : _EnumDemo.values()) {
            if (demoEnum.getCode().equals(code)) {
                return demoEnum;
            }
        }
        return NOT_FOUND;
    }

}
